# ibuild nmb-jmeter-docker
FROM openjdk:8-jre

LABEL COMPANY=lemonban

ARG JMETER_VERSION="5.1.1"
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV	JMETER_BIN	${JMETER_HOME}/bin
ENV	JMETER_DOWNLOAD_URL  https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz

# Install extra packages
# Set TimeZone, See: https://github.com/gliderlabs/docker-alpine/issues/136#issuecomment-612751142
ARG TZ="Asia/Shanghai"
ENV TZ ${TZ}

RUN     apt-get clean \
	&& mkdir -p /tmp/lemonban  \
	&& curl -L --silent ${JMETER_DOWNLOAD_URL} >  /tmp/lemonban/apache-jmeter-${JMETER_VERSION}.tgz  \
	&& mkdir -p /opt  \
	&& tar -xzf /tmp/lemonban/apache-jmeter-${JMETER_VERSION}.tgz -C /opt  \
	&& rm -rf /tmp/lemonban 



# Set global PATH such that "jmeter" command is found
ENV PATH $PATH:$JMETER_BIN

# Entrypoint has same signature as "jmeter" command
COPY containerun.sh /

WORKDIR	${JMETER_HOME}

ENTRYPOINT ["/containerun.sh"]
